a, b, c = input().split()
f = 0
s = 0
for i in range(1):
    if a == "zero":
        s = s + 0
    elif a == "one":
        s = s + 100
    elif a == "two":
        s = s + 200
    elif a == "three":
        s = s + 300
    elif a == "four":
        s = s + 400
    elif a == "five":
        s = s + 500
    elif a == "six":
        s = s + 600
    elif a == "seven":
        s = s + 700
    elif a == "eight":
        s = s + 800
    elif a == "nine":
        s = s + 900
    else:
        f = 1


for i in range(1):
    if b == "zero":
        s = s + 0
    elif b == "one":
        s = s + 10
    elif b == "two":
        s = s + 20
    elif b == "three":
        s = s + 30
    elif b == "four":
        s = s + 40
    elif b == "five":
        s = s + 50
    elif b == "six":
        s = s + 60
    elif b == "seven":
        s = s + 70
    elif b == "eight":
        s = s + 80
    elif b == "nine":
        s = s + 90
    else:
        f = 1

for i in range(1):
    if c == "zero":
        s = s + 0
    elif c == "one":
        s = s + 1
    elif c == "two":
        s = s + 2
    elif c == "three":
        s = s + 3
    elif c == "four":
        s = s + 4
    elif c == "five":
        s = s + 5
    elif c == "six":
        s = s + 6
    elif c == "seven":
        s = s + 7
    elif c == "eight":
        s = s + 8
    elif c == "nine":
        s = s + 9
    else:
        f = 1
i = 0
if f == 1:
    print("Wrong input")
else:
    ss = [101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
    while f != 2:
        if ss[i] * -1 < s * -1:
            
            f = 2
        i += 1
print(s)
            
        
 

